<?php
include dirname(dirname(dirname(__FILE__))).'/admin-verify.php';
require dirname(dirname(__FILE__)).'/functions.php';
$_className=addslashes($_GET["className"]);
$result=getGoodsAndPhotoByClass($_className);
$res="";
foreach ($result as $row )
{
if ($row['pid']!=""&&$row['pid']!=null) {
	
if (deletePhoto($row['pid'])) {
	if(unlink(dirname(dirname(dirname(dirname(__FILE__))))."/images/".$row['store_name'])){

		if (deleteGoods($row['id'])) {
				
		}else {
			$res="商品信息删除失败";
				
		}

	}else {
		$res="图片存储删除失败";

	}


}else {

	$res="图片记录删除失败";

}
}
}


if ($res=="") {
	if (deleteGoodsClass($result[0]['gc_id'])) {
		$res="success";
	
	}else {
		$res="商品类别信息删除失败";
	
	}
}

echo $res;
?>